<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	
	<body>	
	<h6><kbd>&nbsp;友情链接列表&nbsp;</kbd></h6>
			<div>
				<a href="{:U(MODULE_NAME.'/Links/create')}" class="btn btn-info btn-sm">新增友情链接</a>
				<a href="" class="btn btn-info btn-sm">删除已选链接</a>
				<a href="" class="btn btn-info btn-sm">排序</a>
			<p></p>
				<table class="table table-condensed table-hover table-striped table-responsive">
					<thead>
						<th><input type="checkbox" id="CKALL" /></th>
						<th>链接名称</th>
						<th>链接地址</th>
						<th>排序</th>
						<th>操作</th>
					</thead>
					<tbody>
					<foreach name="links" item="l">
						<tr>
						<td><input type="checkbox" class="ck" /></td>
						<td>{$l.name}</td>
						<td>{$l.href}</td>
						<td><kbd>{$l.orders}</kbd></td>
						<td>
								<div class="btn-group btn-group-xs">
								<a href="{:U(MODULE_NAME.'/Links/edit',array(id=>$l['id']))}" class="btn btn-success">编辑</a>
									<if condition="$l.ishide eq y">
					<a href="{:U(MODULE_NAME.'/Links/update_IShide',array(id=>$l['id'],ishide=>n))}" title="当前为隐藏,点击显示" class="btn btn-info btn-xs">点击显示</a>
					<else />
					<a href="{:U(MODULE_NAME.'/Links/update_IShide',array(id=>$l['id'],ishide=>y))}" title="当前为显示,点击隐藏"  class="btn btn-danger  btn-xs">点击隐藏</a>
					</if>
								<a onclick="DeleteFunction({$l.id},this)" url="{:U(MODULE_NAME.'/Links/delete',array(id=>$l['id']))}" href="javascript:void(0)" data-toggle="modal" class="btn btn-warning">删除</a>								
							</div>
							
							
						</td>
						</tr>
					
					</foreach>
					
					</tbody>
				</table>
				
			</div>
	
	</body>		
	
<div class="modal fade" id="MyDeleteModal"  tabindex="-1" role="dialog" 
									   aria-labelledby="myModalLabel" aria-hidden="true">
									   <div class="modal-dialog">
									      <div class="modal-content">
									         <div class="modal-header">
									            <button type="button" class="close" 
									               data-dismiss="modal" aria-hidden="true">
									                  &times;
									            </button>
									            <h4 class="modal-title" id="myModalLabel">
									               删除确认
									            </h4>
									         </div>
									         <div class="modal-body">
									            你真的要删除这条友情链接嘛？
									         </div>
									         <div class="modal-footer">
									            <button type="button" class="btn btn-success" 
									               data-dismiss="modal">关闭
									            </button>
									              <a href="Del.php?id=XXX" class="btn btn-danger btnDeleteOK">确定删除</a>
									         </div>
									      </div><!-- /.modal-content -->
	</div><!-- /.modal -->
	
	<script>
		function DeleteFunction(id,sender)
		{
			$('.btnDeleteOK').attr('href','');
			$('#MyDeleteModal').modal('show').on('shown.bs.modal',function()
			{
				$('.btnDeleteOK').attr('href',$(sender).attr('url'));
			});
		}   
		$('#CKALL').change(function()
		{
			$('.ck').prop('checked',$(this).prop('checked'));
		})
		$('.ck').change(function()
		{
			$('#CKALL').prop('checked',$('.ck').length==$('.ck:checked').length?true:false);
		})
		
	</script>
	
</html>
